<?php

namespace iBrand\Member\Backend\Models;

use iBrand\Component\Point\Traits\PointTrait;
use iBrand\Component\User\Models\User as BaseUser;

class User extends BaseUser
{
	use PointTrait;
	/**
	 * The attributes that should be hidden for arrays.
	 *
	 * @var array
	 */
	protected $hidden = [
		'password', 'remember_token',
	];

    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);

        $this->setTable('el_user');
    }

	public function setPasswordAttribute($value)
	{
		return $this->attributes['password'] = bcrypt($value);
	}

	public function getActionButtonsAttribute()
	{
		return $this->getEditButtonAttribute();
	}

	public function getEditButtonAttribute()
	{
		return '<a href="' . route('admin.users.edit', ['id' => $this->id, 'redirect_url' => urlencode(\Request::getRequestUri())]) . '" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="' . '编辑' . '"></i></a> ';
	}
}
